Saturday, May 31, 2008

No vhost.conf in httpd.include OR Changing default DocumentRoot directory

I have Plesk installed as server management tool and I wanted to point multiple site to
single DocumentRoot for that purpose I opend httpd.include (for plesk normally present
in /var/www/vhsots//conf). There was a note that you should over ride the
setting in vhost.conf if u want, but there was no vhost.conf in the /conf directory
hence I created it (vi vhost.conf) and enter following code in it

DocumentRoot /path/to/new/documentroot


php_admin_flag engine on
php_admin_flag safe_mode on
php_admin_value open_basedir "/path/to/new/documentroot:/tmp"


and restarted my server, but changes didnt reflect hence I googled and found following
solution.

If you dont find following "Include /var/www/vhosts/conf/conf/vhost.conf" line
in httpd.include then run following command

/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=yourdomain.com

Plesk will add "Include" statement in httpd.include

And restart the server (service httpd restart OR /etc/init.d/httpd restart)

And Cheers..

---

I have found one more solution which is I can say technical cheating :) by creating
symbolic link

you remove any custom changes in your vhost.conf file and remove or rename the httpdocs directory entirely.

Then you run ln -s /path/to/new/documentroot httpdocs which will create the link.

This way Apache will still read from /path/to/old/documentroot and all the

settings will apply correctly, but the files are actually stored on the new path.